<UserControl x:Class="StockTraderRI.Modules.Watch.WatchList.WatchListView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:Converters="clr-namespace:StockTraderRI.Infrastructure.Converters;assembly=StockTraderRI.Infrastructure"
    xmlns:Commands="clr-namespace:Microsoft.Practices.Composite.Presentation.Commands;assembly=Microsoft.Practices.Composite.Presentation"
    xmlns:Infrastructure="clr-namespace:StockTraderRI.Infrastructure;assembly=StockTraderRI.Infrastructure"
    Height="Auto" Width="Auto">
    <UserControl.Resources>
        <Converters:CurrencyConverter x:Key="currencyConverter" />
        <!-- The following resources are used as a workaround because in Silverlight we cannot bind to a RelativeSource -->
        <Infrastructure:ObservableCommand x:Key="RemoveWatchCommand" />
    </UserControl.Resources>
    <Controls:DataGrid x:Name="WatchListGrid" ItemsSource="{Binding Path=WatchListItems}" 
		AutoGenerateColumns="False" BorderThickness="0,0,0,0" Width="Auto" 
		HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{x:Null}" 
		BorderBrush="{x:Null}" HeadersVisibility="Column"
        Style="{StaticResource CustomDataGridStyle}" GridLinesVisibility="None" 
        Foreground="#FF666666" CellStyle="{StaticResource NoSelectionDataGridCellStyle}" 
		ColumnHeaderStyle="{StaticResource CustomHeaderStyle}" 
		SelectionMode="Single" IsReadOnly="True"
		DragIndicatorStyle="{StaticResource CustomHeaderStyle}" 
		RowStyle="{StaticResource CustomGridRowStyle}" AutomationProperties.AutomationId="WatchListGrid" >
		<Controls:DataGrid.Columns>
			<Controls:DataGridTextColumn Header="Symbol" Binding="{Binding Path=TickerSymbol}"/>
			<Controls:DataGridTextColumn Header="Current Price" Binding="{Binding Converter={StaticResource currencyConverter}, Path=CurrentPrice}"/>
            <Controls:DataGridTemplateColumn Header="Actions">
                <Controls:DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                            <Button Commands:Click.Command="{Binding Path=Value, Source={StaticResource RemoveWatchCommand}}" Commands:Click.CommandParameter="{Binding Path=TickerSymbol}" AutomationProperties.AutomationId="ActionsRemoveButton" Template="{StaticResource RemoveXButtonTemplate}" Cursor="Hand" />
                    </DataTemplate>
                </Controls:DataGridTemplateColumn.CellTemplate>
            </Controls:DataGridTemplateColumn>
		</Controls:DataGrid.Columns>
	</Controls:DataGrid>
</UserControl>

